<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE HTML PUBLIC "" "">
<f:view xmlns="http://www.w3.org/1999/xhtml" xmlns:f="http://java.sun.com/jsf/core"
	xmlns:w="http://www.apusic.com/jsf/widget" xmlns:layout="http://www.apusic.com/jsf/layout"
	xmlns:h="http://java.sun.com/jsf/html" xmlns:ajax="http://www.apusic.com/jsf/ajax"
	renderKitId="AJAX">
	<w:head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
		<w:stylesheet src="/css/kmp4.css" type="text/css"></w:stylesheet>
		<w:script src="/javascript/k4.js" type="text/javascript" language="UTF-8"></w:script>
		<script>
		 	//<![CDATA[
		 	 function operationFormatter(v, m , r, rIndex){
		 	  var dirId = r.get('id');
			  var con = "<a href='javascript:upDir(\""+dirId+"\")'>特殊信息</a>";
			  var att = "<a href='javascript:showAtt(\""+dirId+"\")'>应急阶段</a>";
			  ret =con+"|"+att;
			  return ret;
		   }
		    function freshme(){
 		      var store=listEventGridJsvar.getStore();
		      store.reload(store.lastOptions);
     	    }
     	    function checkDelete(){
		 	  var r = listEventGridJsvar.getSelectionModel().getSelected();
    		  if(r == null){
    			alert('请选择一条记录!');
    			return false;
    		  }
    		  return showConfirm('确认删除吗?');
		    }
		    function show(v, m, r, rIndex){
             var id=r.get('id');
             var url="#{facesContext.externalContext.requestContextPath}/modules/eop/showEvent.faces?id="+id;
             return "<a href=\"javascript:addCenterLayoutTab('showEventTab','查看应急信息','"+url+"')\">"+v+"</a>";
    	   }
    	   
    	   function showEvent(grid){
    	     var r=grid.getSelectionModel().getSelected();
    	     if(r == null){
    			alert('请选择一条记录!');
    			return false;
    		 }
    		 var url="#{facesContext.externalContext.requestContextPath}/modules/eop/showEvent.faces?id="+r.get('id');;
    		 addCenterLayoutTab('showEventTab','查看应急信息',url);
    	   }
		     //]]>
		 </script>
	</w:head>
	<w:page title="commonView">
		<layout:panel border="false" autoHeight="true" header="false" styleClass="k4-form">
			<layout:panel border="false" autoHeight="true" autoWidth="true" styleClass="k4-view-toolbar">
				<w:form>
					<w:toolBar>
						<w:button label="接警" image="/images/create.gif" id="addEvent" immediate="true"
							onclick="javascript:addCenterLayoutTab('addEventTab','接警','#{facesContext.externalContext.requestContextPath}/modules/eop/addEvent.faces');" />
						<w:separator />
						<w:button label="编辑事件" image="/images/edit.gif" id="editEvent" immediate="true" />
						<w:separator />
						<w:button label="删除事件" image="/images/delete.gif" onclick="return checkDelete();"
							id="deleteEvent" immediate="true" />
					</w:toolBar>
				</w:form>
			</layout:panel>
			<layout:panel>
				<w:form>
					<layout:panelGrid width="100%" columns="4" cellpadding="0" cellspacing="1"
						styleClass="k4-view-searchForm">
						<layout:cell styleClass="k4-form-fieldtitle" style="height: 0px;">
						</layout:cell>
						<layout:cell styleClass="k4-form-fieldvalue" style="height: 0px;">
						</layout:cell>
						<layout:cell styleClass="k4-form-fieldtitle" style="height: 0px;">
						</layout:cell>
						<layout:cell styleClass="k4-form-fieldvalue" style="height: 0px;">
						</layout:cell>
						<layout:cell styleClass="k4-form-fieldtitle">
							<h:outputText value="事件名称"></h:outputText>
						</layout:cell>
						<layout:cell styleClass="k4-form-fieldvalue">
							<w:textField id="eventNameForSearch" jsvar="eventNameJsvar" styleClass="k4-form-textfield"></w:textField>
						</layout:cell>
						<layout:cell colspan="2" styleClass="k4-form-triple-fieldvalue">
							<layout:panelGrid>
								<layout:cell>
									<w:button id="search" label="搜索"
										image="#{facesContext.externalContext.requestContextPath}/images/search.gif" />
								</layout:cell>
								<layout:cell>
									<w:button id="reset" label="重置"
										image="#{facesContext.externalContext.requestContextPath}/images/clear.gif" />
								</layout:cell>
							</layout:panelGrid>
						</layout:cell>
					</layout:panelGrid>
				</w:form>
			</layout:panel>
			<w:dataGrid id="listEventGrid" toolBarPosition="bottom" rows="20" paged="true" border="false"
				showRowNumber="true" styleClass="k4-view-datagrid" autoHeight="true" forceFit="true"
				jsvar="listEventGridJsvar" selectionModel="#{selectionModel.checkbox}" singleSelect="true" ondblclick="showEvent(this);">
				<w:outputColumn id="id" header="id" hidden="true"></w:outputColumn>
				<w:outputColumn id="eventName" header="事件名称" sortable="true" width="80" clientFormatter="show"></w:outputColumn>
				<w:outputColumn id="eventRangeB" header="适用范围大类" width="80" converter="commonKeyFormatter"></w:outputColumn>
				<w:outputColumn id="eventRangeS" header="适用范围细类" width="80" converter="commonKeyFormatter"></w:outputColumn>
				<w:outputColumn id="eventHappenDate" header="发生时间" sortable="true" converter="dateMinuteFormatter"
					width="110"></w:outputColumn>
				<w:outputColumn id="eventAddress" header="发生地点" width="300"></w:outputColumn>
				<w:outputColumn id="eventStatus" header="事件状态" width="100" converter="commonKeyFormatter"></w:outputColumn>
				<w:outputColumn id="eventLevel" header="事件级别" sortable="true" converter="commonKeyFormatter"></w:outputColumn>
				<w:pagingToolbar displayInfo="true" displayMsg="显示 {0} - {1}，共 {2} 条" />
			</w:dataGrid>
		</layout:panel>
	</w:page>
</f:view>